package org.xenon.vote.model.pojo.po;


import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 投票的数据库实体
 */
public class Ballot {
    /**
     * 投票号
     */
    @NotNull(message = "id.null")
    private int id;

    /**
     * 投票名称
     */
    @NotBlank(message = "name.blank")
    @NotNull(message = "name.null")
    private String name;

    /**
     * 投票描述
     */
    @NotNull(message = "description.null")
    @NotBlank(message = "description.blank")
    private String description;

    /**
     * 修改时间
     */
    @NotNull(message = "time.null")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date time;

    /**
     * 创建时间
     */
    @NotNull(message = "time.null")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date birth;

    /**
     * 创建者
     */
    @NotNull(message = "mail.null")
    @NotBlank(message = "mail.blank")
    private String owner;

    public Ballot(@NotNull(message = "id.null") int id,
                  @NotBlank(message = "name.blank")
                  @NotNull(message = "name.null") String name,
                  @NotNull(message = "description.null")
                  @NotBlank(message = "description.blank") String description,
                  @NotNull(message = "time.null") Date time,
                  @NotNull(message = "time.null") Date birth,
                  @NotNull(message = "mail.null")
                  @NotBlank(message = "mail.blank") String owner) {
        this.id = id;
        this.name = name;
        this.description = description;
        this.time = time;
        this.birth = birth;
        this.owner = owner;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getBirth() {
        return birth;
    }

    @SuppressWarnings("unused")
    public void setBirth(Date birth) {
        this.birth = birth;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getOwner() {
        return owner;
    }

    @SuppressWarnings("unused")
    public void setOwner(String owner) {
        this.owner = owner;
    }

    public void setId(int id) {
        this.id = id;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }
}
